import request from "@/utils/request";

// 获取预处理分类树
export const getTreeApi = (params) => {
  return request({
    url: "/pre/category/getPreTree",
    method: "GET",
    params,
  });
};

// 新增预处理分类
export const addTreeApi = (data) => {
  return request({
    url: "/pre/category",
    method: "POST",
    data,
  });
};

// 删除预处理镜像分类接口
export const deleteTreeApi = (ids, preSetType) => {
  return request({
    url: `/pre/category/${preSetType}/${ids}`,
    method: "DELETE",
  });
};

// 修改预处理镜像分类接口
export const updateTreeApi = (data) => {
  return request({
    url: "/pre/category",
    method: "PUT",
    data,
  });
};

// 移动预处理镜像树某个节点
export const moveTreeApi = (data) => {
  return request({
    url: "/pre/category/movePreTree",
    method: "POST",
    data,
  });
};

// 获取预处理镜像管理
export const getImageManageApi = (params) => {
  return request({
    url: "/pre/imageManage/getInfoByPreSetId",
    method: "GET",
    params,
  });
};

// 修改预处理镜像详情接口
export const updateImageManageApi = (data) => {
  return request({
    url: "/pre/imageManage",
    method: "PUT",
    data,
  });
};
// 获取预处理镜像详情接口
export const getImageDetailsApi = (id) => {
  return request({
    url: `/pre/imageManage/${id}`,
    method: "GET",
  });
};
// 获取预处理算法详情接口
export const getAlgorithmDetailsApi = (id) => {
  return request({
    url: `/pre/algorithmManage/${id}`,
    method: "GET",
  });
};

// 启动算法开发环境
export const startAlgorithApi = (id) => {
  return request({
    url: `/pre/algorithmManage/startAlgorithmPod/${id}`,
    method: "GET",
  });
};
// 关闭算法开发环境
export const closeAlgorithApi = (id) => {
  return request({
    url: `/pre/algorithmManage/closeAlgorithmPod/${id}`,
    method: "GET",
  });
};
// 获取在线开发地址
export const getOnlineAddress = (id) => {
  return request({
    url: `/pre/algorithmManage/getOnlineAddress/${id}`,
    method: "GET",
  });
};
// 获取算法样本集列表
export const getSampleDecisionListByType = (params) => {
  return request({
    url: `/sample/category/getSampleDecisionListByType`,
    method: "GET",
    params
  });
};
// 修改预处理算法详情接口
export const updateAlgorithmManageApi = (data) => {
  return request({
    url: "/pre/algorithmManage",
    method: "PUT",
    data,
  });
};
// 获取基准版本
export const getBaseVersionList = (id) => {
  return request({
    url: `/pre/algorithmManage/getBaseVersionList`,
    method: "GET",
    params: { 'preSetCategoryId': id }
  });
};
// 获取预处理任务流详情接口
export const getFlowmDetailsApi = (id) => {
  return request({
    url: `/pre/flow/${id}`,
    method: "GET",
  });
};
// 启动任务流
export const startTaskFlow = (data) => {
  return request({
    url: "/pre/flow/startTaskFlow",
    method: "POST",
    data,
  });
};

// 关闭任务流
export const closeFlowApi = (id) => {
  return request({
    url: `/pre/flow/inst/stop/${id}`,
    method: "GET",
  });
};
// 修改预处理算法详情接口
export const updateFlowApi = (data) => {
  return request({
    url: "/pre/flow",
    method: "PUT",
    data,
  });
};

// 获取预处理任务流树接口
export const getPreAlgOperatorBuildTree = () => {
  return request({
    url: "/pre/category/getPreAlgOperatorBuildTree",
    method: "GET",
    params: { 'preSetType': 2 },
  });
};
// 获取算法资源使用情况
export const getPodResourceUsage = (id) => {
  return request({
    url: `/pre/algorithmManage/getPodResourceUsage/${id}`,
    method: "GET",
  });
};

// 获取任务流实例数据
export const getFlowInst = (id) => {
  return request({
    url: `/pre/flow/inst/${id}`,
    method: "GET",
  });
};

